<%@ taglib prefix="spring-tags" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="spring-form" uri="http://www.springframework.org/tags/form"%>
<%@ page
    import="org.jiscinvolve.astrodabis.mallow.model.api.Tag"
    import="org.jiscinvolve.astrodabis.mallow.model.api.Query"
    import="org.jiscinvolve.astrodabis.mallow.model.api.QueryTag"
    import="org.jiscinvolve.astrodabis.mallow.model.api.Result"
    import="org.jiscinvolve.astrodabis.mallow.model.api.Account"
    import="org.jiscinvolve.astrodabis.mallow.model.tap.TapTable"
    import="org.jiscinvolve.astrodabis.mallow.model.tap.TapService"
    import="org.jiscinvolve.astrodabis.mallow.control.ViewData"
    session="true"
%>
<%@ include file="/jsp/init.jsp" %>
<%@ include file="/jsp/tables/init.jsp" %>
<html>
    <head>
	    <title>AstroDAbis TAP table [<%= table.service().name() %>][<%= table.name() %>]</title>
        <link href='/astrodabis/css/page.css' rel='stylesheet' type='text/css'/>
    </head>
    <body>
        <%@ include file="/jsp/header.jsp" %>
        <div class='body'>
            <div class='left'>
                <%@ include file="/jsp/menu.jsp" %>
            </div>
            <div class='right'>
                <a href='<%= data.path(table) %>'>
                    <img src='<%= data.qrcode(data.path(table)) %>'/>
                </a>
            </div>
            <div class='content'>
        	    <h2>TAP table [<%= table.service().name() %>][<%= table.name() %>]</h2>
                <fieldset>
                    <legend>Table details</legend>
                    <div>
                        <ul>
                            <li>
                                Name : <%= table.name() %>
                            </li>
                            <li>
                                Created : <%= table.created() %>
                            </li>
                            <li>
                                Owner : <a href='<%= data.path(table.owner()) %>'><%= table.owner().name() %></a>
                            </li>
                            <li>
                                Service : <a href='<%= data.path(table.service()) %>'><%= table.service().name() %></a>
                            </li>

                            <li>
                                Primary key : <%= table.key() %>
                            </li>

                        </ul>
                    </div>
                    <%
                    if (data.owner(table))
                        {
                        %>
                        <a href='<%= data.path(table, "edit") %>'>[edit]</a>
                        <%
                        }
                    %>
                </fieldset>
                <fieldset>
                    <legend>Description</legend>
                    <div>
                        <%= table.text() %>
                    </div>
                    <%
                    if (data.owner(table))
                        {
                        %>
                        <a href='<%= data.path(table, "edit") %>'>[edit]</a>
                        <%
                        }
                    %>
                </fieldset>

                <fieldset>
                    <legend>Columns</legend>
                    <table border='1'>
                        <tr>
                            <th>Name</th>
                            <th>Description</th>
                        </tr>
                    </table>
                    <%
                    if (data.owner(table))
                        {
                        %>
                        <a href='<%= data.path(table, "columns/create") %>'>[add]</a>
                        <%
                        }
                    %>
                </fieldset>

            </div>
        </div>
        <%@ include file="/jsp/footer.jsp" %>
    </body>
</html>

